<?
require_once("../config/dbconn.php");require_once("../config/powercls.php");require_once("../config/pagecls.php");

if($action=='del'){
	$db->delete("{$db_prefix}caiwu","id='$id'");
	echo "<script>location.href='caiwu_lst.php?pageno={$pageno}';</script>";exit();
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	
}
td{
font-size:12px;
}
.red{
	color:#FF0000
}
-->
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/caiwu_lst.js"></script>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">会员财务记录</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <tr>
                  <td align="center" class="left_bt2"><form name="form1" method="post" action="?action=query" style="margin:0px;">
                    会员：
                        <label>
                        <input name="username" type="text" id="username" size="10">
                        </label>
                        金额：
                        <label>
                    <input name="price1" type="text" id="price1" size="5">
                    </label>
                   -                  
                   <input name="price2" type="text" id="price2" size="5">
                   <label></label>
                   账户类型：
                   <label>
                   <select name="ptype" id="ptype" onChange="ptypechange()">
				   <option value="">全部账户</option>
				   <?
				   foreach($hypricetypeary as $k1=>$v1){
				   	echo "<option value='{$k1}'>{$v1}</option>";
				   }
				   ?>
                   </select>
                   财务类型：
                   <select name="type" id="type">
				   <option value="">全部类型</option>
                   </select>
                   </label>
                   <label>
                   <input type="submit" name="Submit" value="查询">
                   </label>
				   
				   
				   <label id="ptype_notice" class="red"></label>  <label id="reg_notice" class="red"></label>
                  </form>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="30"><table width="100%" height="60" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td height="30" align="center" bgcolor="#f2f2f2" >编号</td>
                  <td align="center" bgcolor="#f2f2f2" >会员</td>
                  <td align="center" bgcolor="#f2f2f2" >账户类型</td>
                  <td align="center" bgcolor="#f2f2f2" >财务类型</td>
                  <td align="center" bgcolor="#f2f2f2" >金额</td>
                  <td align="center" bgcolor="#f2f2f2" >说明</td>
                  <td align="center" bgcolor="#f2f2f2" >记录时间</td>
                  </tr>
  <?
  $query='';
  if ($action=='query'){
  	if (trim($username)!='') $query.=" and username='".trim($username)."'";
  	if (trim($price1)!='') $query.=" and a.price>='".trim($price1)."'";
	if (trim($price2)!='') $query.=" and a.price<='".trim($price2)."'";
	if (trim($ptype)!='') $query.=" and ptype='".trim($ptype)."'";
	if (trim($type)!='') $query.=" and type='".trim($type)."'";
  }
  $sql="select count(a.id) as c  from {$db_prefix}caiwu a,{$db_prefix}users b where a.userid=b.id";
  if ($query!='') $sql.=$query;
  $rs=$db->get_one($sql);
  $page=new pagecls(20,intval($rs['c']));
  $sql="select a.*,b.username from {$db_prefix}caiwu a,{$db_prefix}users b where a.userid=b.id";
  if ($query!='') $sql.=$query;
  $sql.=" order by a.id desc limit {$page->pastnum},{$page->pagesize}";
  $result=$db->query($sql);
  while($rs=$db->fetch_array($result)){
  ?>
                <tr>
                  <td height="30" align="center"><?=$rs['id']?></td>
                  <td align="center" ><?=$rs['username']?></td>
                  <td align="center" ><?=$hypricetypeary[$rs['ptype']]?></td>
                  <td align="center" ><?
				  if ($rs['ptype']==1){
				  	echo $hypriceary[$rs['type']];
				  }
				  if ($rs['ptype']==2){
				  	echo $hysfpriceary[$rs['type']];
				  }
				   if ($rs['ptype']==3){
				  	echo $hyznpriceary[$rs['type']];
				  }
				   if ($rs['ptype']==4){
				  	echo $hyslpriceary[$rs['type']];
				  }
				  if ($rs['ptype']==5){
				  	echo $hyjypriceary[$rs['type']];
				   }
				  if ($rs['ptype']==6){
				  	echo $hygwpriceary[$rs['type']];
				  }
				  if($rs['ptype'] ==7){
                      echo $hydjpriceary[$rs['type']];
                  }
				  ?></td>
                  <td align="center" ><?=$rs['price']?></td>
                  <td align="center" ><?=$rs['memo']?></td>
                  <td align="center" ><?=date("Y-m-d H:i:s",$rs['addtime'])?></td>
                  </tr>
	<?
  }
  $db->free_result($result);
  ?>
              </table></td>
            </tr>
            
            <tr>
              <td height="30">&nbsp;</td>
            </tr>
            <tr>
              <td height="30" align="right">每页<?=$page->pagesize?>条 第<?=$page->pageno?>/<?=$page->pagenum?>页 共<?=$page->recnum?>条 <a href='?<?=$page->url?>1'><img src="image1/first.gif" border="0"></a>   <a href='?<?=$page->url.($page->pageno-1)?>'><img src="image1/back.gif" border="0"></a>  <a href='?<?=$page->url.($page->pageno+1)?>'><img src="image1/next.gif" border="0"></a>   <a href='?<?=$page->url.$page->pagenum?>'><img src="image1/last.gif" border="0"></a></td>
              </tr>
            <tr>
              <td height="30">&nbsp;</td>
            </tr>
          </table></td>
      </tr>
    </table></td>
    <td background="images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>

</body>
</html>
